package test;

public class test7_封装 {
    private String name;
    private int age;
    private double height;

    public void setAge(int age) {
        if (age >= 18 && age < 50) {
            System.out.println("女朋友的年龄是" + age);
        } else {
            System.out.println("请输入正确的年龄在18~50之间");
        }
    }

    public void setName(String name) {
        System.out.println("女朋友的名字是" + name);
    }

    public void setHeight(double height) {
        if (height > 0.0 && height < 400.0) {
            System.out.println("女朋友的身高是" + height);
        }
    }
}
